package com.example.edu.Mapper;

import com.example.edu.Entity.Article_Tag;
import com.example.edu.Entity.Tag;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface Article_TagMapper {
    void insert(@Param("article_id") int article_id, @Param("tags") List<Tag> tags,@Param("telephone") String telephone);

    @Delete("delete from article_tag where article_id = #{article_id}")
    void delete(@Param("article_id") int article_id);

    @Select("select t.tag_name from article_tag at join tag t on at.tag_id = t.tag_id where at.article_id = #{article_id}")
    List<String> getTagNames(@Param("article_id") int article_id);

    List<Article_Tag> getRelations(@Param("article_ids") List<Integer> article_ids);


}
